package com.ekalenchuk.postAd.domain.site;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;

import com.ekalenchuk.postAd.domain.commercial.FieldValue;

@Entity
@Table(name="field_dictionary")
public class FieldDictionary implements Serializable{

	private static final long serialVersionUID = -5945944340017732348L;

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name="id")
	private Long id;

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "field", cascade = { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.REMOVE })
	@OrderBy("id")
	private List<SiteField> field;
	
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "field", cascade = { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.REMOVE })
	@OrderBy("id")
	private List<FieldValue> values;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public List<SiteField> getField() {
		return field;
	}

	public void setField(List<SiteField> field) {
		this.field = field;
	}

	public List<FieldValue> getValues() {
		return values;
	}

	public void setValues(List<FieldValue> values) {
		this.values = values;
	}

	
}
